package mil.af.amc.adpetracker.web.actions.struts1;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.*;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by IntelliJ IDEA.
 * User: schevus.osborne
 * Date: Feb 6, 2007
 * Time: 8:33:20 AM
 */

public class AbstractAction extends Action {

    private static Log log = LogFactory.getLog(AbstractAction.class);

    protected void saveError(HttpServletRequest request, ActionMessage actionMessage) {

        ActionMessages actionMessages = new ActionMessages();
        actionMessages.add(ActionMessages.GLOBAL_MESSAGE, actionMessage);
        addErrors(request, actionMessages);

    }

    protected void saveMessage(HttpServletRequest request, ActionMessage actionMessage) {

        ActionMessages actionMessages = new ActionMessages();
        actionMessages.add(ActionMessages.GLOBAL_MESSAGE, actionMessage);
        addMessages(request, actionMessages);
    }

    protected ActionForward findForwardSuccess(ActionMapping actionMapping) {

        return actionMapping.findForward("success");

    }

    protected ActionForward findForwardFailure(ActionMapping actionMapping) {

        return actionMapping.findForward("failure");

    }


}
